<template>
    <Row>
        <Col span="24">
            <Table
                    highlight-row
                    @on-current-change=""
                    :columns="columns"
                    :data="data"
            >
            </Table>
        </Col>
    </Row>
</template>

<script>
    const {ipcRenderer} = require('electron')

    export default {
        name: "Message",
        components: {},
        data() {
            return {
                columns: [
                    {
                        type: 'index',
                        width: 60,
                        align: 'center'
                    },
                    {
                        title: '标题',
                        key: 'account'
                    },
                    {
                        title: '内容',
                        key: 'username'
                    }
                ],
                data: [{
                    name: 'John Brown',
                    age: 18,
                    address: 'New York No. 1 Lake Park',
                    date: '2016-10-03'
                }]
            }
        },
        methods: {
            checkLogin() {
                 this.$http({
                    method: 'post',
                    url: this.apiBase + '/blog/user/list',
                    data: {}
                })
                    .then(response => {
                        if (response.data.code == 401) {
                            ipcRenderer.send('close-messageWindow', "close-messageWindow")
                            ipcRenderer.send('send-message', "send-message111")
                        }
                        if (response.data.code == 200) {
                            this.data = response.data.data.users;
                        }
                    })
                    .catch(error => {
                        console.log(error);
                    })
            }
        },
        created() {
            this.checkLogin()
        }
    }
</script>

<style scoped>

</style>